package com.dslab.danteng;

import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;

public class MusicPlayer {

	private MediaPlayer bgVoice = null;
	private MediaPlayer clickRightVoice = null;
	private MediaPlayer clickWrongVoice = null;

	public MusicPlayer(Context context) {
		bgVoice = MediaPlayer.create(context, R.raw.bg);
		bgVoice.setLooping(true);
		bgVoice.setAudioStreamType(AudioManager.STREAM_MUSIC);
		clickRightVoice = MediaPlayer.create(context, R.raw.right);
		clickRightVoice.setAudioStreamType(AudioManager.STREAM_MUSIC);
		clickWrongVoice = MediaPlayer.create(context, R.raw.wrong);
		clickWrongVoice.setAudioStreamType(AudioManager.STREAM_MUSIC);
	}

	public void playBgVoice() {
		bgVoice.start();
	}

	public void playClickRightVoice() {
		clickRightVoice.start();
	}
	
	public void playClickWrongVoice() {
		clickWrongVoice.start();
	}

	public void setPause() {
		bgVoice.pause();
	}

	public void free() {
		bgVoice.stop();
		bgVoice.release();
		clickRightVoice.release();
		clickWrongVoice.release();
	}

}
